package com.spacing.app.data;

import java.io.Serializable;
import java.util.ArrayList;


/**
 * @author Paul
 * @comment Een chapter bestaat uit meerdere secties. Er kunnen meerdere Chapters zijn.
 */
@SuppressWarnings("serial")
public class Chapter implements Serializable{
	private ArrayList<Section> sections = new ArrayList<Section>();
	private String name;

	public void addSection(Section s) {
		sections.add(s);
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public Section get(int index) {
		return sections.get(index);
	}

	public int size() {
		return sections.size();
	}

	public ArrayList<Word> getWords() {
		ArrayList<Word> words = new ArrayList<Word>();
		for (int i = 0; i < sections.size(); i++) {
			for (int j = 0; j < sections.get(i).size(); j++) {
				words.add(sections.get(i).get(j));
			}
		}
		return words;
	}

	public ArrayList<String> getNames() {
		ArrayList<String> names = new ArrayList<String>();
		for(int i=0;i<sections.size();i++){
			names.add(sections.get(i).getName());
		}
		return names;
	}
	
}